#pragma once
#include <vmmlib/matrix.hpp>
#include <vmmlib/vector.hpp>
#include <Eigen/Eigen>
#include "Face.h"
#include <QGLWidget>
using namespace vmml;

class Mesh
{
private:
	int numVerts;
	int numTriangles;
	vec3d* pt;
	vec3d* tf;
	double* ptdata;
	int numNormals;
	vec3d* norm;
	int numFaces;
	//Face* face;
	vmml::vector<1,Face>* face;
	vmml::vector<3,int>* tri;
	

	int vertAppend;
	int normAppend;
	int faceAppend;
	int triAppend;

	int findVertex(vec3d &v);


public:
	Mesh(int verts,int trian,int normals,int faces);
	Mesh(void);
	~Mesh(void);
	void setFaceCount(int f, int count);
	void addPoint(vec3d& v,vec3d& n,int f,double ftle);
	void addPoints(vec3d& v1,vec3d& v2,vec3d& v3);
	void addTriangle(vec3d& v1, vec3d& v2, vec3d& v3,int f,vec3d& i1,vec3d& i2,vec3d& i3);
	void addEigenTriangle(Eigen::VectorXd& v1, Eigen::VectorXd& v2, Eigen::VectorXd& v3,int f, Eigen::VectorXd& intensity);
	void draw();
	void drawTriangles(double alpha);
	void toWaveFrontObject();
	void draw2DSlice();
	vec3d* getVertices();
	int getNumberOfVertices();
};
